ruby:
  expired_left = @app_info.expired_date - Time.current
  alert_left_class = case Time.at(expired_left).day
                     when 180..365
                       'alert-success'
                     when 31..179
                       'alert-warning'
                     when 0..30
                       'alert-warning'
                     else
                       'alert-danger'
                     end

.row
  .col-md-8
    .card
      .card-header
        h3.card-title 描述文件
        .card-tools
          button.btn.btn-tool data-card-widget="collapse"
            i.fas.fa-minus
      .card-body
        .alert class="#{alert_left_class}"
          = "描述文件还有#{distance_of_time_in_words(Time.current, @app_info.expired_date)}过期"
        dl.system-info
          dt 名称
          dd
            pre = @app_info.name
          dt 应用标识
          dd
            pre = @app_info.app_name
          dt 平台
          dd
            pre = @app_info.platform
          dt 类型
          dd
            pre = @app_info.type
          dt UUID
          dd
            pre = @app_info.UUID
          dt 团队名称 (Team ID)
          dd
            pre = "#{@app_info.team_name} (#{@app_info.team_identifier.first})"
          dt 创建时间
          dd
            pre = @app_info.created_date
          dt 过期时间
          dd
            pre
              = @app_info.expired_date

    .card
      .card-header
        h3.card-title Entitlements
        .card-tools
          button.btn.btn-tool data-card-widget="collapse"
            i.fas.fa-minus
      .card-body
        dl.system-info
          - @app_info.entitlements.sort.each do |name, value|
            dt = name
            dd
              pre = value

    - if @app_info.devices.present?
      .card
        .card-header
          h3.card-title
            | 设备列表 (
            = @app_info.devices.size
            | )
          .card-tools
            button.btn.btn-tool data-card-widget="collapse"
              i.fas.fa-minus
        .card-body.p-0
          table.table
            - @app_info.devices.each do |udid|
              tr
                td
                  span = udid
                  - if (device = Device.find_by(udid: udid)) && device.name.present?
                    .float-right
                      small.badge.badge-light
                        = device.name

  .col-md-4
    .card
      .card-header
        h3.card-title 已启用功能
        .card-tools
          button.btn.btn-tool data-card-widget="collapse"
            i.fas.fa-minus
      .card-body
        table.table.table-striped
          - @app_info.enabled_capabilities.each do |key|
            tr
              td = key